package org.jcc.core.cs.functional;

public class IfElseSum {
	
	public static void main(String[] args) {


		int idSum = sum("identity");
		int sqSum = sum("square");
		int cbSum = sum("cube");
		
		System.out.print(idSum + " " + sqSum + " " + cbSum);
	}
	
	public static int sum(String type) {
		int sum = 0;
		for (int i = 1; i <= 100; i++) {
			int temp = 0;
			if ("identity".equals(type)) {
				temp = i;
			} else if ("square".equals(type)) {
				temp = i * i;
			} else if ("cube".equals(type)){
				temp = i * i * i;
			} else {
				// TODO error
			}
			sum += temp;
		}
		return sum;
	}
}
